/*
//���ú���
//2006-12-30
*/
function  mycheckbox(objName)
{
	var   obj   =  document.getElementsByName(objName);
	var   flag   =   false;
	for   (var   i   =   0   ;   i   <   obj.length   ;   i++   )
	{
		if   (   obj[i].checked   ==   true)   {
		flag   =   true;
		break;
	}
}
	return   flag;
}
//���´���
function winOpen(url,title,width,height){
    var w = 1024;
    var h = 768;

    if (document.all || document.layers){
        w = screen.availWidth;
        h = screen.availHeight;
    }

    var leftPos = (w/2-width/2);
    var topPos = (h/2.3-height/2.3);

    window.open(url,title,"width="+width+",height="+height+",top="+topPos+",left="+leftPos+",scrollbars=yes,resizable=no,status=no");
}
// ��ʾ��ģʽ�Ի���
function ShowDialog(url, width, height) {
	var arr = showModalDialog(url, window, "dialogWidth:" + width + "px;dialogHeight:" + height + "px;help:no;scroll:no;status:no");
}

//�ַ���;
//ȥ���ҿո�;
function trim(s){
 	return s.replace( /^\s*$/, "");
}
//ȥ��ո�;
function ltrim(s){
 	return s.replace( /^\s*/, "");
}
//ȥ�ҿո�;
function rtrim(s){
 	return s.replace( /\s*$/, "");
}
//��֤��Ϣ;
//���ַ�ֵ;
function isEmpty(s){
	s = trim(s);
	return s.length == 0;
}
//Email;
function isEmail(s){
	s = trim(s);
 	var p = /^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.){1,4}[a-z]{2,3}$/i;
 	return p.test(s);
}
//Double;
function isDouble(s){
	s = trim(s);
	var p = /^[-\+]?\d+(\.\d+)?$/;
	return p.test(s);
}
//Integer;
function isInteger(s){
	s = trim(s);
	var p = /^[-\+]?\d+$/;
	return p.test(s);
}
//Date;
function isDate(sDate){
	var re = /^((\d{2}(([02468][048])|([13579][26]))[\-\/\s]?((((0?[13578])|(1[02]))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\-\/\s]?((0?[1-9])|([1-2][0-9])))))|(\d{2}(([02468][1235679])|([13579][01345789]))[\-\/\s]?((((0?[13578])|(1[02]))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\-\/\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))(\s((([01]?[0-9])|(2[0-3]))\:([0-5]?[0-9])((\s)|(\:([0-5]?[0-9])))))?$/;
	return re.test(sDate);
}
//return document.getElementById
function $() {
  var elements = new Array();

  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);

    if (arguments.length == 1)
      return element;

    elements.push(element);
  }

  return elements;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function $getObj(obj){return document.getElementById(obj);}
function CommonTab(sum,obj,objG,objT,ps){
	var g = $getObj(obj);
	var gG = g.getElementsByTagName(objG);
	for(var i=ps;i<gG.length;i++){
		if(i==sum || gG[i]==sum){
			with(gG[i]){className = "down";style.cursor = "default";}
			gG[i].onclick = function(){return false;};
			gG[i].onmousemove = function(){return false;};
			gG[i].onmouseout = function(){return false;};
			if(objT!=null){$getObj(objT+i).style.display = "block";}
		}else{
			with(gG[i]){className = "";style.cursor = "pointer";}
			gG[i].onclick = function(){CommonTab(this,obj,objG,objT,ps);};
			gG[i].onmousemove = function(){this.className = "move";};
			gG[i].onmouseout = function(){this.className = "";};
			if(objT!=null){$getObj(objT+i).style.display = "none";}
		}
	}
}
function CommonTabMove(sum,obj,objG,cursor,objT,objTG){
	var cf = (cursor==0) ? "pointer" : "default";
	var g = $getObj(obj);
	var gG = g.getElementsByTagName(objG);
	if(objT!=null && objTG!=null){
		var gT = $getObj(objT);
		var gTG = gT.getElementsByTagName(objTG);
	}
	for(var i=0;i<gG.length;i++){
		if(i==sum || gG[i]==sum){
			with(gG[i]){className = "down";style.cursor = cf;}
			gG[i].onmousemove = function(){return false;};
			if(objT!=null){if(objTG==null){$getObj(objT+i).style.display = "block";}else{gTG[i].style.display = "block";}}
		}else{
			with(gG[i]){className = "";style.cursor = cf;}
			gG[i].onmousemove = function(){CommonTabMove(this,obj,objG,cursor,objT,objTG);};
			if(objT!=null){if(objTG==null){$getObj(objT+i).style.display = "none";}else{gTG[i].style.display = "none";}}
		}
	}
}
function showFlash(iUrl,iWidth,iHeight,iWmode,cli){
	flash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ iWidth +'" height="' + iHeight +'"/>';
	flash = flash + '<param name="movie" value="'+ iUrl +'" />';
	if (iWmode == 1) {flash = flash + '<param name="wmode" value="transparent" />';	}
	flash = flash + '<embed src="' + iUrl + '" width="'+ iWidth +'" height="'+ iHeight +'" ';
	if (iWmode == 1) {flash = flash + 'wmode="transparent"';}
	flash = flash + ' pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" mwode="transparent"></embed></object>';
	if(cli==1){return flash;}else{document.writeln(flash);}
}
function topNtime(obj,s){
	var NtS,NtF,str="",NtY,dateB=weekB=timeB=false;
	today=new Date();
	function initArray(){ this.length=initArray.arguments.length; for(var i=0;i<this.length;i++){this[i+1]=initArray.arguments[i];} }
	switch(s){
		case "date":dateB=true;break;
		case "week":weekB=true;break;
		case "time":timeB=true;break;
		default:dateB=weekB=timeB=true;
	}
	if(dateB){ var yn=today.getYear()<2000?today.getYear()-100+2000:today.getYear(); NtY = today.getMonth()+1; str += yn + "年" + NtY + "月" + today.getDate() + "日 "; }
	if(weekB){ var d=new initArray( "星期日", "星期一", "星期二", "星期三", "星期四","星期五", "星期六"); str += d[today.getDay()+1] + " &nbsp;"; }
	if(timeB){
		var newF = today.getMinutes(),newM = today.getSeconds();
		if(newF ==0||newF ==1||newF ==2||newF ==3||newF ==4||newF ==5||newF ==6||newF ==7||newF ==8||newF ==9){newF = "0"+newF;}
		if(newM ==0||newM ==1||newM ==2||newM ==3||newM ==4||newM ==5||newM ==6||newM ==7||newM ==8||newM ==9){newM = "0"+newM;}
		str += today.getHours() +":"+ newF +":"+ newM;
		setTimeout("topNtime('"+obj+"','"+s+"')",1000);
	}
	$getObj(obj).innerHTML = str;
}

function CommonTabMove2(obj,objT){
	var g = $getObj(obj);
	var gG = g.getElementsByTagName(objT);
	for(var i=0;i<gG.length;i++){
		gG[i].onmousemove = function(){ this.getElementsByTagName("ul")[0].style.display = "block"; };
		gG[i].onmouseout = function(){ this.getElementsByTagName("ul")[0].style.display = "none"; };
	}
}
new CommonTabMove2("Head_mObj","div");
